import 'package:flutter/material.dart';
import 'package:hook_up_rent/pages/room_add/room_add.dart';

class CommonFormRadio extends StatelessWidget {

  final String label;
  final List<String> options;
  final int value;
  final ValueChanged<int> onChange;

  const CommonFormRadio({Key key, this.label, this.options, this.value, this.onChange}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(left: commonPadding, right: commonPadding),
      decoration: BoxDecoration(
          border: Border(
              bottom: BorderSide(
                  width: 1.0, color: Theme.of(context).dividerColor))),
      child: Row(
        children: [
          Container(
            width: 100.0,
            child: Text(
              label,
              style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600),
            ),
          ),
          Expanded( 
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: List.generate(options.length, (index) => Row(
                  children: [
                    Radio(
                      value: index,
                      groupValue: value,
                      onChanged: onChange,
                    ),
                    Text(options[index])
                  ],
                )),
            )
          ),
        ],
      ),
    );
  }
}
